package com.supplychainapi.service;

import com.joindata.inf.common.basic.exceptions.ServiceException;
import com.supplychainapi.common.RestResponse;
import com.supplychainapi.domain.MaterialList;
import com.supplychainapi.domain.MaterialListSearch;
import com.supplychainapi.domain.Rate;
import com.supplychainapi.model.ScmTbmaterial;
import com.supplychainapi.model.ScmTbtreebuild;
import com.supplychainapi.param.ColTitle;
import com.supplychainapi.param.TbmaterialParam;

import java.util.List;
import java.util.Map;

/**
 * Created by wangziqi on 2017/9/26.
 */
public interface TbMaterialService {
    /**
     * 新增
     * @param model
     * @return
     */
    RestResponse save(TbmaterialParam model)throws ServiceException;

    /**
     * 更新
     * @param model
     * @return
     */
    RestResponse update(TbmaterialParam model)throws ServiceException;

    /**
     * 物理删除
     * @param model
     * @return
     */
    RestResponse delete(TbmaterialParam model)throws ServiceException;

    /**
     * 查询所有 根据店铺id
     * @param shopGuid
     * @return
     */
    RestResponse<List<ScmTbtreebuild>> selectAll(String shopGuid) throws ServiceException;


    /**
     * 获取分类 级别至二级
     * @param shopGuid
     * @return
     */
    RestResponse<List<ScmTbtreebuild>> getMaterialAllClass(String shopGuid);

    /**
     * 查询单个
     * @param shopGuid
     * @param id
     * @return
     * @throws ServiceException
     */
    RestResponse<TbmaterialParam> selectById(String shopGuid, String id) throws com.joindata.inf.common.basic.exceptions.ServiceException;


    /**
     * 根据name搜索
     * @param shopGuid
     * @param name
     * @return
     */
    RestResponse<List<ScmTbmaterial>> search(String shopGuid, String name,Integer page,Integer size);


    /**
     * 根据一级分类查询该分类下所有物料
     * @param shopGuid
     * @param fsNodeCode
     * @return
     */
    RestResponse<List<ScmTbmaterial>> selectByClass(String shopGuid,String fsNodeCode,Integer page,Integer size);


    /**
     * 根据二级分类查询子级分类 及 物料清单
     * @param shopGuid
     * @param fsNodeCode
     * @return
     */
    RestResponse selectByTwoClass(String shopGuid,String fsNodeCode);


    /**
     * 获取所有物料不区分分类
     * @param shopGuid
     * @param page
     * @param size
     * @return
     */
    RestResponse getAllMaterial(String shopGuid,Integer page,Integer size);

    /**
     * 根据属性统计总数
     * @param param
     * @return
     */
    int count(TbmaterialParam param);

    /**
     * pc获取物料列表
     * @param search
     * @return
     */
    RestResponse<List<MaterialList>> pcGetAllMaterial(MaterialListSearch search);



    int supplierQuotes(String shopGuid,String supplierId);


    List<ColTitle> getSchema();

    List<ColTitle> getSelectSchema();


    Map<String,List<Rate>> geTrate();


    int selectByWarehouseId(String warehouseId, String shopGuid);

    List<ScmTbmaterial> findFullCode(String shopGuid, String fullCode);

    int updateFullTextName(ScmTbmaterial model);
}
